package com.event.ingestion.data.hbase;

import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;

public class UserParser extends com.event.ingestion.data.UserParser<Put> {
    @Override
    public Put parse(String[] fields) {
        Put p = new Put(Bytes.toBytes(fields[0]));  //rowkey

        //profile
        p = p.addColumn(Bytes.toBytes("profile"),Bytes.toBytes("birth_year"),Bytes.toBytes(fields[2]));
        p = p.addColumn(Bytes.toBytes("profile"),Bytes.toBytes("gender"),Bytes.toBytes(fields[3]));

        //region
        p = p.addColumn(Bytes.toBytes("region"),Bytes.toBytes("locale"),Bytes.toBytes(fields[1]));
        p = p.addColumn(Bytes.toBytes("region"),Bytes.toBytes("location"),Bytes.toBytes(fields[5]));
        p = p.addColumn(Bytes.toBytes("region"),Bytes.toBytes("time_zone"),Bytes.toBytes(fields[6]));

        //registration:joined_at
        p = p.addColumn(Bytes.toBytes("registration"),Bytes.toBytes("joined_at"),Bytes.toBytes(fields[4]));

        return p;
    }
}
